﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace canyinguanlixitong
{
    public partial class frmaddmoney : Form
    {
        public frmaddmoney()
        {
            InitializeComponent();
        }
        string strconn = "Data Source=.;Initial Catalog=Supermarket management system;Integrated Security=True";
        private void textBox3_TextChanged(object sender, EventArgs e)
        {
  
        }

        private void frmaddmoney_Load(object sender, EventArgs e)
        {

        }
        public void search() { 
            
        }

        private void buttonsure1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(strconn);
            conn.Open();
            string name = this.textBox3.Text;
            int money = Convert.ToInt32(this.textBox1.Text);
            string bo = this.textBox4.Text;
            string style = this.textBox2.Text;
            int id =Convert.ToInt32(this.textBox5.Text);
            string sql = @"insert into	dbo.fybiao(fyName,fymoney,fytype,fyman,fyID)
                            values('" + name + "','" + money + "','" + style + "','" + bo + "','"+id+"')";
            SqlCommand cmd = new SqlCommand(sql, conn);
            int result = cmd.ExecuteNonQuery();
            if (result > 0)
            {
                 MessageBox.Show("新增成功");
            }
            else
            {
                MessageBox.Show("新增失败");
            }
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void buttonbreak2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
